sprintf — Create formatted string


\begin{rail}
FormattedString : 'sprintf' '(' String ',' String ( ( ',' Variable ) * ) ')' ;
\end{rail}
The sprintf function allows a formatted string to be copied to a variable. It is similar to the C language function of the same name, though some features are limited or not available, since doesn't have all the data types of C. The first argument is the name of the target string. If it is already a string, the old contents are deleted. If it is not already a string, then it is deleted, and a new string is created. If it doesn't exist, it is created. The second string argument is the format string. It consists of the text to be written out, and possibly some conversion specifications. A conversion specification is a sequence of commands that determine how the remainder of the arguments are to be displayed. The left most conversion specifier is matched to the third argument, the next specifier to the fourth argument, and so on. Each argument has to be matched to a conversion specification. When the format string is being scanned, the argument that matches the the specifier that the scanner is up to is called the current argument . Conversion specifications always begin with a +